﻿//
// Copyright (c) 2024 BPergaofeng
//
#ifndef SRC_BPerENCODER_BPerENCODERGPU_H_
#define SRC_BPerENCODER_BPerENCODERGPU_H_
#include <bperencoder/BPerVideoEncoder.h>
#include <bperutil/buffer/BPerVideoBuffer.h>
#include <bperutil/buffer/BPerVideoEncoderBuffer.h>
#include <bperutil/sys/BPerIni.h>
#include "codec/BPerH264EncoderGpu.h"
class BPerEncoderGpu: public BPerVideoEncoder {
public:
    BPerEncoderGpu();
	virtual ~BPerEncoderGpu();
		//static void initX265Param(BPerVideoInfo *pvp,BPerVideoEncInfo *penc,x265_param *param);
        int32_t init(BPerContext* pcontext,BPerVideoInfo *pvp);
		void setVideoMetaData(BPerVideoMeta *pvmd);
		bool isSupported();
		void parseRtmpHeader(uint8_t *p, int32_t pLen, int32_t *pwid, int32_t *phei, int32_t *pfps);
        void sendMsgToEncoder(BPerRtcEncoderMessage *msg);
	private:

		int32_t m_sendKeyframe;
		//int32_t encode(uint8_t *src,int32_t buflen, uint8_t *dest, int32_t *destLen, int32_t *frametype);
		int32_t encode(BPerFrame* pframe, BPerEncoderCallback* pcallback);
	protected:
        BPerH264EncoderGpu* m_encoder;
        BPerFrame m_videoFrame;


};

#endif /* SRC_BPerENCODER_BPerENCODERGPU_H_ */
